#include "key.h"

#define KEY1 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_0)
#define KEY2 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)
#define KEY3 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_2)
#define KEY4 HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)
#define KEY_PORT (KEY1) | (KEY2 << 1) | (KEY3 << 2) | (KEY4<<3) | 0xf0

uint8_t Trg;
uint8_t con;

void Key_Read(void)
{
	uint8_t read;
	read  = (KEY_PORT) ^ 0xff;
	Trg = read & (read ^ con);
	con = read;
}